package object3.package1;

public class Rectangle extends Shape{
    private int length; //长
    private int width;  //宽

    public Rectangle() {
        super();
    }

    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
        calcArea();
    }

    public void setLength(int length) {
        this.length = length;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    @Override
    public void draw() {
        System.out.println("■");
    }

    @Override
    public void calcArea() {
        area = length * width;
    }

    @Override
    public String toString() {
        return "Rectangle{" +
                "length=" + length +
                ", width=" + width +
                ", area=" + area +
                '}';
    }
}
